package com.etc.web;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloController {
    /**
     * URL是hello.action的时候运行这个类
     * @param name
     * @param age
     * @return
     */
    @RequestMapping("/hello.action")
    public ModelAndView hello(@RequestParam("ename") String name, int age) {
        System.out.println(name + "@" + age);
        ModelAndView mav = new ModelAndView();
        mav.setViewName("hello");
        mav.addObject("message", "model中的数据");

        return mav;

    }
}
